package com.company;

import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;

import static java.lang.Thread.sleep;

public class TestSocketClient {

    public static void main(String[] args) {
        Socket client = null;
        DataOutputStream dos = null;
        try {
            client = new Socket("127.0.0.1", 33333);
            dos = new DataOutputStream(client.getOutputStream());
            for (int i = 0; i < 1000; i++) {
                try {
                    sleep(50);
                    dos.writeUTF("1000001000011111" + i);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }

        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                if (client != null) client.close();
                if (dos != null) dos.close();
            } catch (Exception e) {

            }

        }
    }
}
